﻿#ifndef FTAG_H
#define FTAG_H

#include <QWidget>

namespace Ui {
class FTag;
}

class FTag : public QWidget
{
    Q_OBJECT

public:
    explicit FTag(const QString& msg, const QIcon& icon, const QColor& bgColor, QWidget *parent = nullptr);
    ~FTag();

    void setText(const QString& text);
    void setIcon(const QIcon& icon);

signals:
    void clicked();

private slots:
    void on_btnClose_clicked();

    bool eventFilter(QObject *watched, QEvent* e) override;

private:
    Ui::FTag *ui;
    bool m_pressed = false;
};

class FFileTag : public FTag
{
    Q_OBJECT

public:
    explicit FFileTag(const QString& filePath, const QColor& bgColor, QWidget* parent = nullptr);

    void setFilePath(const QString& filePath);

    bool isFileValid() const;

    qint64 fileSize() const;
    QString filename() const;
    QByteArray getFileContent();

protected:
    void initView();

private slots:
    void onClicked();

private:
    QString m_filePath;
};

#endif // FTAG_H
